package com.ocom.mqsubsidy.controller;

import com.alibaba.fastjson.JSON;
import com.ocom.common.constant.MqPay;
import com.ocom.common.request.payconfig.AddSubsidyDataByPersonRequest;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.mqsubsidy.business.subsidydataaddperson.SubsidyDataAddPersonProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class SubsidyDataAddPersonController {

    @Autowired
    private SubsidyDataAddPersonProductService subsidyDataAddPersonProductService;

    @PostMapping(MqPay.URL_subsidyDataaddPerson)
    public Result subsidyDataAddPerson(@RequestBody AddSubsidyDataByPersonRequest addSubsidyDataByPersonRequest){
        String msg = JSON.toJSONString(addSubsidyDataByPersonRequest);
        subsidyDataAddPersonProductService.handle(msg);
        return ResultUtil.success();
    }
}
